package com.myjob.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

/**
 * @author Chen Yuan
 * @create 2021-02-10  16:51
 */
@Controller
@RequestMapping("/oa/blog")
public class BlogController {

    @GetMapping("/blogPage")
    public String blogPage() {
        return "/common/blog/blog";
    }

    @GetMapping("/blogDetailsPage/{blogId}")
    public String blogDetailsPage(@PathVariable("blogId") Long blogId, Model model) {
        model.addAttribute("blogId", blogId);
        return "/common/blog/blogDetails";
    }

    @GetMapping("/createBlogPage/{blogId}/{isUpdate}")
    public String createBlogPage(@PathVariable(value = "blogId", required = false) Long blogId,
                                 @PathVariable(value = "isUpdate", required = false) Integer isUpdate,
                                 Model model) {
        model.addAttribute("blogId", blogId);
        model.addAttribute("isUpdate", isUpdate);
        return "/common/blog/blogCreate";
    }

    @GetMapping("/markdownPage")
    public String markdownPage() {
        return "/common/blog/markdown";
    }

    @GetMapping("/myBlogPage")
    public String myBlogPage() {
        return "/common/blog/myBlog";
    }

    @GetMapping("/reviewsPage")
    public String ReviewsPage() {
        return "/common/blog/reviews";
    }
}
